﻿/**
*LayoutParams
*auth:lww
*version:1.0
*date:2014-10-11
*/
var MATCH_PARENT = -1;
var WRAP_CONTENT = -2;
function LayoutParams(w, h) {
    this.version = "1.0.0";
    this.name = "LayoutParams";
    this.mWidth = w;
    this.mHeight = h;
    this.mTopMargin = 0;
    this.mLeftMargin = 0;
    this.mRightMargin = 0;
    this.mBottomMargin = 0;
    this.mTopPadding = 0;
    this.mLeftPadding = 0;
    this.mRightPadding = 0;
    this.mBottomPadding = 0;    
}
LayoutParams.prototype.getWidth = function () {
    if (this.mWidth === MATCH_PARENT)
        return "100%";
    else if (this.mWidth === WRAP_CONTENT)
        return "auto";
    return this.mWidth + "px";
};
LayoutParams.prototype.getHeight = function () {
    if (this.mHeight === MATCH_PARENT)
        return "100%";
    else if (this.mHeight === WRAP_CONTENT)
        return "auto";
    return this.mHeight + "px";
};
LayoutParams.prototype.setMargin = function (l, t, r, b) {
    this.mTopMargin = t;
    this.mLeftMargin = l;
    this.mRightMargin = r;
    this.mBottomMargin = b;
};
LayoutParams.prototype.getMarginLeft = function () {
    if (this.mLeftMargin === WRAP_CONTENT)
        return "auto";
    return this.mLeftMargin + "px";
};
LayoutParams.prototype.getMarginTop = function () {
    if (this.mTopMargin === WRAP_CONTENT)
        return "auto";
    return this.mTopMargin + "px";
};
LayoutParams.prototype.getMarginRight = function () {
    if (this.mRightMargin === WRAP_CONTENT)
        return "auto";
    return this.mRightMargin + "px";
};
LayoutParams.prototype.getMarginBottom = function () {
    if (this.mBottomMargin === WRAP_CONTENT)
        return "auto";
    return this.mBottomMargin + "px";
};
LayoutParams.prototype.setPadding = function (l, t, r, b) {
    this.mTopPadding = t;
    this.mLeftPadding = l;
    this.mRightPadding = r;
    this.mBottomPadding = b;
};
LayoutParams.prototype.getPaddingLeft= function () {
    if (this.mLeftPadding === WRAP_CONTENT)
        return "auto";
    return this.mLeftPadding + "px";
};
LayoutParams.prototype.getPaddingTop = function () {
    if (this.mTopPadding === WRAP_CONTENT)
        return "auto";
    return this.mTopPadding + "px";
};
LayoutParams.prototype.getPaddingRight = function () {
    if (this.mRightPadding === WRAP_CONTENT)
        return "auto";
    return this.mRightPadding + "px";
};
LayoutParams.prototype.getPaddingBottom = function () {
    if (this.mBottomPadding === WRAP_CONTENT)
        return "auto";
    return this.mBottomPadding + "px";
};

markscript("LayoutParams");
//end LayoutParams.js
